From dd573bc0e5b31fabaa671022ea3635b63fe540fc Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Wed, 19 May 1993 06:03:04 +0000 Subject: [PATCH] * files.el (set-auto-mode): If the buffer's file name is nil, don't try to compare it against the entries in auto-mode-alist. --- lisp/files.el | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/lisp/files.el b/lisp/files.el index 64ba881b71a..6a207dbec7b 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -798,16 +798,17 @@ If `enable-local-variables' is nil, this function does not check for a (setq mode (buffer-substring beg (point)))))) (setq mode (buffer-substring beg end))))) (setq mode (intern (concat (downcase mode) "-mode"))) - (let ((alist auto-mode-alist) - (name buffer-file-name)) - (let ((case-fold-search (eq system-type 'vax-vms))) - ;; Remove backup-suffixes from file name. - (setq name (file-name-sans-versions name)) - ;; Find first matching alist entry. - (while (and (not mode) alist) - (if (string-match (car (car alist)) name) - (setq mode (cdr (car alist)))) - (setq alist (cdr alist))))))) + (if buffer-file-name + (let ((alist auto-mode-alist) + (name buffer-file-name)) + (let ((case-fold-search (eq system-type 'vax-vms))) + ;; Remove backup-suffixes from file name. + (setq name (file-name-sans-versions name)) + ;; Find first matching alist entry. + (while (and (not mode) alist) + (if (string-match (car (car alist)) name) + (setq mode (cdr (car alist)))) + (setq alist (cdr alist)))))))) (if mode (funcall mode)))) (defun hack-local-variables-prop-line () -- 2.30.2